

<template>
  <view class="Mall4j container">

    <view class="page flex-col">
      <view class="section_1 ">
        <view class="section_6 flex-col">
          <view v-if="isAuthInfo" class="image-text_4 flex-row justify-between" @tap="toPersonalInformation">
            <image mode="aspectFill" class="image_1" referrerpolicy="no-referrer" :src="userInfo.pic?userInfo.pic : 'https://mall-1312577323.cos.ap-chengdu.myqcloud.com/mall/images/icon/head04.png'" />
            <view class="text-group_4 flex-col justify-between">
              <text class="text_1 clamp_text">{{ userInfo.nickName ? userInfo.nickName : i18n.userNickname }}</text>
              <text class="text_2 clamp_text">用户名：{{ userInfo.userName }}</text>
            </view>
          </view>
          <view v-else class="image-text_4 flex-row justify-between" @tap="toLogin">
            <image mode="aspectFill" class="image_1" referrerpolicy="no-referrer" src="https://mall-1312577323.cos.ap-chengdu.myqcloud.com/mall/images/icon/head04.png" />
            <view class="text-group_4 flex-col justify-between">
              <text class="text_1 clamp_text" style="margin-top: 16rpx">{{ showLogOut ? i18n.loginNow : i18n.registration }}</text>
              <!--              <text class="text_2 clamp_text">用户名：{{ userInfo.userName }}</text>-->
            </view>
          </view>

          <view class="justify-center">
            <view class="block_1 flex-row">
              <text class="text_3">积分兑换</text>
              <text class="text_3_"> | </text>
              <text class="text_4 clamp_text">3356积分即可兑换和田玉平安扣和田玉平安扣和田玉平安扣</text>
              <view class="text-wrapper_1 flex-col" @tap="go_points_redemption">
                <text class="text_5">去看看</text>
              </view>
            </view>
          </view>
          <view class="justify-center">
            <view class="block_2 flex-col">
              <view class="text-wrapper_2 flex-row justify-between">
                <text class="text_6">{{ i18n.myOrder }}</text>
                <text class="text_7" data-sts="0" @tap="toOrderListPage">{{ i18n.seeMore }}
                  <!-- <image mode="aspectFill" class="thumbnail_1" referrerpolicy="no-referrer" src="https://mall-1312577323.cos.ap-chengdu.myqcloud.com/mall/images/user/MasterDDSSlicePNG67e0036e43c9a97ab003c6a1a9bc6ba9.png" /> -->
                </text>
              </view>
              <view class="justify-center">
                <view class="group_1 ">
                  <!--                  <view class="image-text_5 flex-col justify-between" data-sts="1" @tap="toOrderListPage">-->
                  <!--                    <image mode="aspectFill" class="label_4" referrerpolicy="no-referrer" src="https://mall-1312577323.cos.ap-chengdu.myqcloud.com/mall/images/user/MasterDDSSlicePNG8b922ec4c59a1c37461dae8134789e5f.png" />-->
                  <!--                    <text class="text-group_5">{{ i18n.toBePaid }}</text>-->
                  <!--                    <view class="text-wrapper_3 flex-col text-wrapper_x1" v-if="orderAmount.unPay>0">-->
                  <!--                      <text class="text_8">{{ orderAmount.unPay }}</text>-->
                  <!--                    </view>-->
                  <!--                  </view>-->
                  <!--                  <view class="image-text_5 flex-col justify-between" data-sts="2" @tap="toOrderListPage">-->
                  <!--                    <image mode="aspectFill" class="label_4" referrerpolicy="no-referrer" src="https://mall-1312577323.cos.ap-chengdu.myqcloud.com/mall/images/user/MasterDDSSlicePNGe8ca2a25bae8dbd3fb68819b843ad813.png" />-->
                  <!--                    <text class="text-group_5">{{ i18n.toBeDelivered }}</text>-->
                  <!--                    <view class="text-wrapper_3 flex-col text-wrapper_x2" v-if="orderAmount.payed>0">-->
                  <!--                      <text class="text_8">{{ orderAmount.payed }}</text>-->
                  <!--                    </view>-->
                  <!--                  </view>-->
                  <!--                  <view class="image-text_5 flex-col justify-between" data-sts="3" @tap="toOrderListPage">-->
                  <!--                    <image mode="aspectFill" class="label_4" referrerpolicy="no-referrer" src="https://mall-1312577323.cos.ap-chengdu.myqcloud.com/mall/images/user/MasterDDSSlicePNG9ef95a92b0a2baa37c07acafafd36439.png" />-->
                  <!--                    <text class="text-group_5">{{ i18n.toBeReceived }}</text>-->
                  <!--                    <view class="text-wrapper_3 flex-col text-wrapper_x3" v-if="orderAmount.consignment>0">-->
                  <!--                      <text class="text_8">{{ orderAmount.consignment }}</text>-->
                  <!--                    </view>-->
                  <!--                  </view>-->

                  <!--                  <view class="image-text_5 flex-col justify-between" data-sts="5" @tap="toOrderListPage">-->
                  <!--                    <image mode="aspectFill" class="label_4" referrerpolicy="no-referrer" src="https://mall-1312577323.cos.ap-chengdu.myqcloud.com/mall/images/user/MasterDDSSlicePNGb7d1a54b6b49166ecc0de773577a1a14.png" />-->
                  <!--                    <text class="text-group_5">{{ i18n.completed }}</text>-->
                  <!--                    <view class="text-wrapper_3 flex-col" v-if="false">-->
                  <!--                      <text class="text_8">2</text>-->
                  <!--                    </view>-->
                  <!--                  </view>-->
                  <!--                  <view class="image-text_5 flex-col justify-between" @tap="toAfterSalesPage">-->
                  <!--                    <image mode="aspectFill" class="label_4" referrerpolicy="no-referrer" src="https://mall-1312577323.cos.ap-chengdu.myqcloud.com/mall/images/user/MasterDDSSlicePNG04c3d2747c3bbff2cb7fa89ec2447e6c.png" />-->
                  <!--                    <text class="text-group_5">{{ i18n.refundAfterSale }}</text>-->
                  <!--                    <view class="text-wrapper_3 flex-col text-wrapper_x5" v-if="orderAmount.refund>0">-->
                  <!--                      <text class="text_8">{{ orderAmount.refund }}</text>-->
                  <!--                    </view>-->
                  <!--                  </view>-->
                  <view class="myOrders">
                    <view class="myOrder one" data-sts="1" @tap="toOrderListPage">
                      <image mode="aspectFill" class="flex-image" referrerpolicy="no-referrer" src="https://mall-1312577323.cos.ap-chengdu.myqcloud.com/mall/images/user/MasterDDSSlicePNG8b922ec4c59a1c37461dae8134789e5f.png" />
                      <view><text class="">{{ i18n.toBePaid }}</text></view>
                      <view class="dot" v-if="orderAmount.unPay>0">
                        <text class="dot-num">{{ orderAmount.unPay }}</text>
                      </view>
                    </view>
                    <view class="myOrder two" data-sts="2" @tap="toOrderListPage">
                      <image mode="aspectFill" class="flex-image" referrerpolicy="no-referrer" src="https://mall-1312577323.cos.ap-chengdu.myqcloud.com/mall/images/user/MasterDDSSlicePNGe8ca2a25bae8dbd3fb68819b843ad813.png" />
                      <view><text class="">{{ i18n.toBeDelivered }}</text></view>
                      <view class="dot" v-if="orderAmount.payed>0">
                        <text class="dot-num">{{ orderAmount.payed }}</text>
                      </view>
                    </view>
                    <view class="myOrder three" data-sts="3" @tap="toOrderListPage">
                      <image mode="aspectFill" class="flex-image" referrerpolicy="no-referrer" src="https://mall-1312577323.cos.ap-chengdu.myqcloud.com/mall/images/user/MasterDDSSlicePNG9ef95a92b0a2baa37c07acafafd36439.png" />
                      <view><text class="">{{ i18n.toBeReceived }}</text></view>
                      <view class="dot" v-if="orderAmount.consignment>0">
                        <text class="dot-num">{{ orderAmount.consignment }}</text>
                      </view>
                    </view>
                    <view class="myOrder four" data-sts="5" @tap="toOrderListPage">
                      <image mode="aspectFill" class="flex-image" referrerpolicy="no-referrer" src="https://mall-1312577323.cos.ap-chengdu.myqcloud.com/mall/images/user/MasterDDSSlicePNGb7d1a54b6b49166ecc0de773577a1a14.png" />
                      <view><text class="">{{ i18n.completed }}</text></view>
                      <view class="dot" v-if="false">
                        <text class="dot-num">2</text>
                      </view>
                    </view>
                    <view class="myOrder five" @tap="toAfterSalesPage">
                      <image mode="aspectFill" class="flex-image" referrerpolicy="no-referrer" src="https://mall-1312577323.cos.ap-chengdu.myqcloud.com/mall/images/user/MasterDDSSlicePNG04c3d2747c3bbff2cb7fa89ec2447e6c.png" />
                      <view><text class="">{{ i18n.refundAfterSale }}</text></view>
                      <view class="dot" v-if="orderAmount.refund>0">
                        <text class="dot-num">{{ orderAmount.refund }}</text>
                      </view>
                    </view>
                  </view>
                </view>
              </view>

            </view>

          </view>
          <!-- <view class="justify-center" style="padding:  20rpx  10rpx 0; ">
            <view class="section_2 flex-col">
              <view class="list_1 ">
                <view class="image-text_1 flex-col justify-between" v-if="canDistribution" @tap="toDistCenter">
                  <image mode="aspectFill" class="label_1" referrerpolicy="no-referrer" src="https://mall-1312577323.cos.ap-chengdu.myqcloud.com/mall/images/user/MasterDDSSlicePNGb4a4aad70446e6d170a5ff0591a61efd.png" />
                  <text class="text-group_1">{{ i18n.distributioncenter }}</text>
                </view>
                <view class="image-text_1 flex-col justify-between" @tap="toCouponList">
                  <image mode="aspectFill" class="label_1" referrerpolicy="no-referrer" src="https://mall-1312577323.cos.ap-chengdu.myqcloud.com/mall/images/user/MasterDDSSlicePNGa4b0e4152f73685387c382930b983242.png" />
                  <text class="text-group_1">兑换卡</text>
                </view>
                <view class="image-text_1 flex-col justify-between" @tap="myCollectionHandle">
                  <image mode="aspectFill" class="label_1" referrerpolicy="no-referrer" src="https://mall-1312577323.cos.ap-chengdu.myqcloud.com/mall/images/user/MasterDDSSlicePNG254bb3c1e80715a939e83c6fefef71b5.png" />
                  <text class="text-group_1">{{ i18n.myCollection }}</text>
                </view>
                <view class="image-text_1 flex-col justify-between" @tap="myHistory">
                  <image mode="aspectFill" class="label_1" referrerpolicy="no-referrer" src="https://mall-1312577323.cos.ap-chengdu.myqcloud.com/mall/images/user/MasterDDSSlicePNGbbea88c7bd2d8bc1d9c1c31b336c729f.png" />
                  <text class="text-group_1">{{ i18n.history }}</text>
                </view>
              </view>
            </view>
          </view> -->
          <view class="justify-center" style="padding:  20rpx  10rpx;">
            <view class="section_3 flex-col">
              <view class="grid_1 ">
                <view style="display: flex;">
                  <view class="image-text_2" @tap="toAddressList">
                    <image mode="aspectFill" class="label_2" referrerpolicy="no-referrer" src="https://mall-1312577323.cos.ap-chengdu.myqcloud.com/mall/images/user/MasterDDSSlicePNG2462d834f9c6b310c73cd2c30cc6ed7c.png" />
                    <text class="text-group_2">{{ i18n.shippingAddress }}</text>
                  </view>
                  <view class="image-text_2" @tap="gotoChat">
                    <image mode="aspectFill" class="label_2" referrerpolicy="no-referrer" src="https://mall-1312577323.cos.ap-chengdu.myqcloud.com/mall/images/user/MasterDDSSlicePNG7c7e6def78e58f0f8e3486e865a9637e.png" />
                    <text class="text-group_2">{{ i18n.messageBox }}</text>
                  </view>
                  <view class="image-text_2" @click="goAbout">
                    <image mode="aspectFill" class="label_2" referrerpolicy="no-referrer" src="https://mall-1312577323.cos.ap-chengdu.myqcloud.com/mall/images/user/MasterDDSSlicePNGceea1e20540c7ca2c66df796c60d4325.png" />
                    <text class="text-group_2">企业资质</text>
                  </view>
                  <view class="image-text_2" @tap="setPassword">
                    <image mode="aspectFill" class="label_2" referrerpolicy="no-referrer" src="https://mall-1312577323.cos.ap-chengdu.myqcloud.com/mall/images/user/MasterDDSSlicePNG82a5fccf745a1e7f19162796b1fde3fd.png" />
                    <text class="text-group_2">{{ i18n.changePassword }}</text>
                  </view>
                </view>
                <view style="display: flex; margin-top: 35rpx;">
                  <view class="image-text_2" @tap="goPrivacyAgreement">
                    <image mode="aspectFill" class="label_2" referrerpolicy="no-referrer" src="https://mall-1312577323.cos.ap-chengdu.myqcloud.com/mall/images/user/MasterDDSSlicePNG239877f8465b965a43e9ab5451f6631f.png" />
                    <text class="text-group_2">隐私协议</text>
                  </view>
                  <view class="image-text_2" v-if="isAuthInfo" @tap="toPersonalInformation">
                    <image mode="aspectFill" class="label_2" referrerpolicy="no-referrer" src="https://mall-1312577323.cos.ap-chengdu.myqcloud.com/mall/images/user/MasterDDSSlicePNGc72052f67a21f0004d1ba2f36fd9bf56.png" />
                    <text class="text-group_2">设置中心</text>
                  </view>
                </view>
              </view>
            </view>

          </view>

        </view>

      </view>
    </view>
    <!-- 用户信息 -->
    <!-- <view v-if="isAuthInfo" class="userinfo">
      <view class="userinfo-con" @tap="toPersonalInformation">
        <view class="userinfo-avatar">
          <image :src="userInfo.pic?userInfo.pic:'https://mall-1312577323.cos.ap-chengdu.myqcloud.com/mall/images/icon/head04.png'" />
        </view>
        <view class="userinfo-name" @tap="toPersonalInformation">
          <view>{{ userInfo.nickName ? userInfo.nickName : i18n.userNickname }}</view>
        </view>
      </view>
    </view> -->

    <!-- <view v-if="!isAuthInfo" class="userinfo-none" @tap="toLogin">
      <view class="default-pic">
        <image src="https://mall-1312577323.cos.ap-chengdu.myqcloud.com/mall/images/icon/head04.png" />
      </view>
      <view class="none-login">
        <button class="unlogin">{{ showLogOut ? i18n.loginNow : i18n.registration }}</button>
      </view>
    </view> -->
    <!-- end 用户信息 -->

    <!-- 钱包数据 -->
    <!-- <view v-if="isAuthInfo" class="wallet-data"> -->
    <!-- <view class="data-item" @tap="toMyWallet">
        <view class="data-num">{{ i18n.currencySymbol + totalBalance }}</view>
        <view class="data-name">{{ i18n.balance }}</view>
      </view> -->
    <!-- <view class="data-item" @tap="toMyCouponPage">
        <view class="data-num">{{ couponNum }}</view>
        <view class="data-name">{{ i18n.coupon }}</view>
      </view> -->
    <!-- <view class="data-item" @tap="toMemberInteral">
        <view class="data-num">{{ score }}</view>
        <view class="data-name">{{ i18n.integral }}</view>
      </view> -->
    <!-- <view class="data-item" @tap="toMyMessage"> -->
    <!-- #ifndef MP-WEIXIN -->
    <!-- 除了小程序，其它平台均存在的代码 -->
    <!-- <view class="data-num" :style="notifyNum > 0 ? 'margin-left: 16rpx;': ''">{{ notifyNum }}<sup v-if="notifyNum>0" class="dot">●</sup></view> -->
    <!-- #endif -->
    <!-- #ifdef MP-WEIXIN -->
    <!-- 只在微信小程序平台存在的代码 -->
    <!-- <view class="data-num" :style="notifyNum > 0 ? 'margin-left: 16rpx;': ''">{{ notifyNum }}<view v-if="notifyNum>0" class="point">●</view></view> -->
    <!-- #endif -->
    <!-- <view class="data-name">{{ i18n.messageNotify }}</view> -->
    <!-- </view> -->
    <!-- </view> -->
    <!-- 钱包数据 end -->

    <view class="list-cont">

      <!-- 订单状态 -->
      <!-- <view class="total-order">
        <view class="order-tit">
          <text style="font-weight:bold">{{ i18n.myOrder }}</text>
          <view class="checkmore" data-sts="0" @tap="toOrderListPage">
            <text>{{ i18n.seeMore }}</text>
            <text class="arrowhead" />
          </view>
        </view>
        <view class="procedure">
          <view class="items" data-sts="1" @tap="toOrderListPage">
            <image src="https://mall-1312577323.cos.ap-chengdu.myqcloud.com/mall/images/icon/toPay.png" />
            <text>{{ i18n.toBePaid }}</text>
            <text v-if="orderAmount.unPay>0" class="num-badge">{{ orderAmount.unPay }}</text>
          </view>
          <view class="items" data-sts="2" @tap="toOrderListPage">
            <image src="https://mall-1312577323.cos.ap-chengdu.myqcloud.com/mall/images/icon/toDelivery.png" />
            <text>{{ i18n.toBeDelivered }}</text>
            <text v-if="orderAmount.payed>0" class="num-badge">{{ orderAmount.payed }}</text>
          </view>
          <view class="items" data-sts="3" @tap="toOrderListPage">
            <image src="https://mall-1312577323.cos.ap-chengdu.myqcloud.com/mall/images/icon/toTake.png" />
            <text>{{ i18n.toBeReceived }}</text>
            <text v-if="orderAmount.consignment>0" class="num-badge">{{ orderAmount.consignment }}</text>
          </view>
          <view class="items" data-sts="5" @tap="toOrderListPage">
            <image src="https://mall-1312577323.cos.ap-chengdu.myqcloud.com/mall/images/icon/toComment.png" />
            <text>{{ i18n.completed }}</text>
          </view>
          <view class="items" @tap="toAfterSalesPage">
            <image src="https://mall-1312577323.cos.ap-chengdu.myqcloud.com/mall/images/icon/refund.png" />
            <text v-if="orderAmount.refund>0" class="num-badge">{{ orderAmount.refund }}</text>
            <text>{{ i18n.refundAfterSale }}</text>
          </view>
        </view>
      </view> -->
      <!--end 订单状态 -->
      <view class="my-menu">
        <!-- <view class="memu-item" @tap="sacnCode">
          <view class="i-name">
            <image src="https://mall-1312577323.cos.ap-chengdu.myqcloud.com/mall/images/icon/scanCode.png" />
            <text>{{ i18n.scanCodePickup }}</text>
          </view>
          <view class="arrowhead" />
        </view> -->
        <!-- <view class="memu-item" @tap="toMemberIndex">
          <view class="i-name">
            <image src="https://mall-1312577323.cos.ap-chengdu.myqcloud.com/mall/images/icon/huiyuanzhongxin@2x.png" />
            <text>{{ i18n.membershipCentre }}</text>
          </view>
          <view class="arrowhead" />
        </view> -->
        <!-- <view v-if="canDistribution" class="memu-item" @tap="toDistCenter">
          <view class="i-name">
            <image src="https://mall-1312577323.cos.ap-chengdu.myqcloud.com/mall/images/icon/promotion.png" />
            <text>{{ i18n.distributioncenter }}</text>
          </view>
          <view class="arrowhead" />
        </view> -->
        <!-- <view class="memu-item" @tap="toCouponCenter">
          <view class="i-name">
            <image src="https://mall-1312577323.cos.ap-chengdu.myqcloud.com/mall/images/icon/getCoupon.png" />
            <text>{{ i18n.couponCenter }}</text>
          </view>
          <view class="arrowhead" />
        </view> -->
        <!-- <view class="memu-item" @tap="toMyCouponPage">
					<view class="i-name">
						<image src="https://mall-1312577323.cos.ap-chengdu.myqcloud.com/mall/images/icon/myCoupon.png"></image>
						<text>{{i18n.myDiscountCoupon}}</text>
					</view>
					<view class="arrowhead"></view>
				</view> -->
        <!-- <view class="memu-item" @tap="toAddressList">
          <view class="i-name">
            <image src="https://mall-1312577323.cos.ap-chengdu.myqcloud.com/mall/images/icon/myAddr.png" />
            <text>{{ i18n.shippingAddress }}</text>
          </view>
          <view class="arrowhead" />
        </view>
        <view class="memu-item" @tap="toCouponList">
          <view class="i-name">
            <image src="https://mall-1312577323.cos.ap-chengdu.myqcloud.com/mall/images/icon/myCoupon.png" />
            <text>兑换卡</text>
          </view>
          <view class="arrowhead" />
        </view>
        <view class="memu-item" @tap="myCollectionHandle">
          <view class="i-name">
            <image src="https://mall-1312577323.cos.ap-chengdu.myqcloud.com/mall/images/icon/myCol.png" />
            <text>{{ i18n.myCollection }}</text>
          </view>
          <view class="arrowhead" />
        </view>
        <view class="memu-item" @tap="myHistory">
          <view class="i-name">
            <image src="https://mall-1312577323.cos.ap-chengdu.myqcloud.com/mall/images/icon/history.png" />
            <text>{{ i18n.history }}</text>
          </view>
          <view class="arrowhead" />
        </view>
        <view class="memu-item" @tap="setPassword">
          <view class="i-name">
            <image src="https://mall-1312577323.cos.ap-chengdu.myqcloud.com/mall/images/icon/setting-password.png" />
            <text>{{ i18n.changePassword }}</text>
          </view>
          <view class="arrowhead" />
        </view>
        <button class="memu-btn memu-item" @tap="gotoChat">
          <view class="i-name">
            <image src="https://mall-1312577323.cos.ap-chengdu.myqcloud.com/mall/images/icon/customerService.png" />
            <text>{{ i18n.messageBox }}</text>
          </view>
          <view class="arrowhead" />
        </button>
        <button class="memu-btn memu-item" @click="goAbout">
          <view class="i-name">
            <image src="https://mall-1312577323.cos.ap-chengdu.myqcloud.com/mall/images/icon/service-terms.png" />
            <text>企业资质</text>
          </view>
          <view class="arrowhead" />
        </button> -->
        <!-- <button class="memu-btn memu-item" @click="goPrivacyAgreement">
          <view class="i-name">
            <image src="https://mall-1312577323.cos.ap-chengdu.myqcloud.com/mall/images/icon/setting-password.png" />
            <text>隐私协议</text>
          </view>
          <view class="arrowhead" />
        </button> -->
        <!-- <view class="memu-item" @tap="goPrivacyAgreement">
          <view class="i-name">
            <image src="https://mall-1312577323.cos.ap-chengdu.myqcloud.com/mall/images/icon/setting-password.png" />
            <text>{{ "隐私协议" }}</text>
          </view>
          <view class="arrowhead" />
        </view> -->
        <!-- <view class="memu-item" @tap="toTermsOfService('serviceTerms')">
          <view class="i-name">
            <image src="https://mall-1312577323.cos.ap-chengdu.myqcloud.com/mall/images/icon/service-terms.png" />
            <text>{{ i18n.termsOfService }}</text>
          </view>
          <view class="arrowhead" />
        </view> -->
        <!-- <view class="memu-item" @tap="toTermsOfService('servicePolicy')">
          <view class="i-name">
            <image src="https://mall-1312577323.cos.ap-chengdu.myqcloud.com/mall/images/icon/privacy-policy.png" />
            <text>{{ i18n.privacyPolicy }}</text>
          </view>
          <view class="arrowhead" />
        </view> -->
        <!-- <view class="memu-item" @tap="changeLang">
          <view class="i-name">
            <image src="https://mall-1312577323.cos.ap-chengdu.myqcloud.com/mall/images/icon/switch-lang.png" />
            <text>{{ i18n.switchLang }}</text>
          </view>
          <view class="arrowhead" />
        </view> -->
      </view>
      <!--end 列表项 -->
      <!--      <view v-if="isAuthInfo && showLogOut" class="log-out" @tap="logout">-->
      <!--        <view class="log-out-n">-->
      <!--          <text>{{ i18n.signOut }}</text>-->
      <!--        </view>-->
      <!--      </view>-->

    </view>
  </view>
</template>

<script>
var http = require('../../utils/http.js')
var util = require('../../utils/util.js')
import Wechat from '../../utils/wechat.js'

export default {
  props: {},
  data () {
    return {
      constants: {},
      orderAmount: '',
      sts: '',
      collectionCount: 0,
      canDistribution: false,
      // 分销开关
      isAuthInfo: true,
      userInfo: {},

      couponNum: 0, // 优惠券数量
      score: 0, // 用户积分
      totalBalance: 0, // 用户余额
      notifyNum: 0, // 消息提醒

      // 是否展示退出登录按钮
      showLogOut: uni.getStorageSync('appType') > 2 || uni.getStorageSync('tempUidB2c')

    }
  },

  computed: {
    i18n () {
      return this.$t('index')
    }
  },

  /**
     * 生命周期函数--监听页面加载
     */
  onLoad: function (options) {
    util.transTabbar()
  },

  /**
     * 生命周期函数--监听页面初次渲染完成
     */
  onReady: function () { },

  /**
     * 生命周期函数--监听页面显示
     */
  onShow: function () {
    uni.setNavigationBarTitle({
      title: this.i18n.personalCenter
    })
    http.getCartCount()

    // #ifndef H5
    var logData = uni.getStorageSync('flowAnalysisLogDto')
    uni.setStorageSync('step', uni.getStorageSync('step') / 1 + 1)
    if (logData && logData.pageId != 12) {
      logData.pageId = 12
      logData.step = uni.getStorageSync('step')
      uni.setStorageSync('flowAnalysisLogDto', logData)
      http.saveLog(logData, 1)
    }
    // #endif
    this.isAuthInfo = Boolean(uni.getStorageSync('token'))
    if (this.isAuthInfo) {
      this.getDistInfo()
      this.getOrderCounts()
      this.queryUserInfo()
      this.queryUserData() // 钱包数据
    }
  },

  /**
     * 生命周期函数--监听页面隐藏
     */
  onHide: function () {
    this.setData({
      orderAmount: {}
    })
  },

  /**
     * 生命周期函数--监听页面卸载
     */
  onUnload: function () { },

  /**
     * 页面相关事件处理函数--监听用户下拉动作
     */
  onPullDownRefresh: function () { },

  /**
     * 页面上拉触底事件的处理函数
     */
  onReachBottom: function () { },

  /**
     * 用户点击右上角分享
     */
  onShareAppMessage: function () { },
  methods: {
    go_points_redemption () {
      uni.navigateTo({
        url: `/pages/points-redemption/points-redemption`
      })
    },
    /**
       * 去条款页面
       * */
    toTermsOfService (key) {
      uni.navigateTo({
        url: '/pages/terms-page/terms-page?sts=' + key
      })
    },
    /**
       * 切换语言
       */
    changeLang () {
      const locale = uni.getStorageSync('lang').indexOf('zh') !== -1 ? 'en' : 'zh_CN'
      this._i18n.locale = locale
      uni.setStorageSync('lang', locale)
      uni.setLocale(locale === 'en' ? locale : 'zh-Hans')
      uni.reLaunch({
        url: '/pages/user/user'
      })
    },
    /**
       * 跳转站内消息
       */
    toMyMessage () {
      util.checkAuthInfo(() => {
        uni.navigateTo({
          url: '/pages/recent-news/recent-news?showMessage=1'
        })
      })
    },
    /**
       * 获取用户信息
       */
    queryUserInfo: function () {
      var params = {
        url: '/p/user/userInfo',
        method: 'GET',
        data: {},
        dontTrunLogin: true,
        callBack: (res) => {
          uni.setStorageSync('userInfo', res)
          this.userInfo = res
        }
      }
      http.request(params)
    },

    /**
       * 钱包数据
       */
    queryUserData: function () {
      var params = {
        url: '/p/user/getUserInfo',
        method: 'GET',
        data: {},
        callBack: res => {
          if (uni.getStorageSync('token')) {
            this.setData({
              couponNum: res.couponNum, // 优惠券数量
              score: res.score, // 用户积分
              totalBalance: res.totalBalance, // 用户余额
              notifyNum: res.notifyNum // 消息提醒
            })
          }
        }
      }
      http.request(params)
    },

    /**
       * 获取订单数字
       */
    getOrderCounts: function () {
      // 加载订单数字
      var ths = this
      var params = {
        url: '/p/user/centerInfo',
        method: 'GET',
        dontTrunLogin: true,
        data: {},
        callBack: function (res) {
          ths.setData({
            orderAmount: res.orderCountData
          })
        }
      }
      http.request(params)
    },
    /**
       * 跳转修改用户信息
       */
    toPersonalInformation () {
      util.checkAuthInfo(() => {
        uni.navigateTo({
          url: '/pages/personal-information/personal-information'
        })
      })
    },

    /**
       * 查询分销相关信息
       */
    getDistInfo () {
      // 查询分销开关是否开启
      http.request({
        url: '/p/distribution/distributionBasicSet/canDistribution',
        method: 'GET',
        dontTrunLogin: true,
        data: {
          shopId: 1
        },
        callBack: res => {
          this.setData({
            canDistribution: res == 1
          })
        }
      })
    },

    // 我的钱包
    toMyWallet () {
      util.checkAuthInfo(() => {
        uni.navigateTo({
          url: '/pages/my-wallet/my-wallet'
        })
      })
    },

    /**
       * 扫码自提
       */
    sacnCode: util.throttle(function () {
      util.tapLog(3)
      util.checkAuthInfo(() => {
        // #ifdef H5
        if (!Wechat.isWechat()) {
          uni.showToast({
            title: this.i18n.openInWeChatBrowser,
            icon: 'none'
          })
          return
        }
        Wechat.scanQRCode((codeStr) => {
          var code = ''
          // 处理扫码结果
          if (codeStr.indexOf(',') > -1) {
            code = codeStr.split(',')[1]
          } else {
            code = codeStr
          }
          uni.navigateTo({
            url: '/pages/station-order-list/station-order-list?stationId=' + code
          })
        }, () => {
          uni.showToast({
            title: this.i18n.failedInvokeScan
          })
        })
        // #endif

        // #ifdef APP-PLUS || MP-WEIXIN
        uni.scanCode({
          success: (e) => {
            uni.navigateTo({
              url: '/pages/station-order-list/station-order-list?stationId=' + e.result
            })
          },
          fail: (err) => {
            console.log(err)
          }
        })
        // #endif
      })
    }, 1000),

    /**
       * 跳转会员中心
       */
    toMemberIndex () {
      util.tapLog(3)
      util.checkAuthInfo(() => {
        uni.navigateTo({
          url: '/package-member-integral/pages/member-index/member-index'
        })
      })
    },

    // 跳转到我的足迹
    myHistory () {
      util.tapLog(3)
      util.checkAuthInfo(() => {
        uni.navigateTo({
          url: '/pages/history/history'
        })
      })
    },

    /**
       * 跳转分销员中心
       */
    toDistCenter: function () {
      util.tapLog(3)
      // 判断是否为分销员
      util.checkAuthInfo(() => {
        http.request({
          url: '/p/distribution/user/distributionUserInfo',
          method: 'GET',
          data: {
            shopId: 1
          },
          callBack: res => {
            if (res && res.state == 1) {
              wx.setStorageSync('isDister', true)
              wx.setStorageSync('distCardNo', res.cardNo)
              wx.setStorageSync('distInfo', res)
              uni.navigateTo({
                url: '/pages/dis-center/dis-center'
              })
            } else if (res && res.state == 0) {
              uni.showToast({
                title: this.i18n.applicationReview,
                icon: 'none'
              })
            } else if (res && res.state == 3) {
              uni.showModal({
                title: '',
                content: this.i18n.applicationFailed,
                confirmColor: '#FF6D13',
                cancelText: this.i18n.cancel,
                confirmText: this.i18n.confirm,
                success (res2) {
                  if (res2.confirm) {
                    uni.navigateTo({
                      url: '/pages/apply-dist-con/apply-dist-con'
                    })
                  }
                }
              })
            } else if (res && res.state == 2) {
              uni.showModal({
                title: '',
                content: this.i18n.distributorCleared,
                confirmColor: '#eb2444',
                cancelText: this.i18n.cancel,
                confirmText: this.i18n.confirm,
                success (res2) {
                  if (res2.confirm) {
                    uni.navigateTo({
                      url: '/pages/apply-dist-con/apply-dist-con'
                    })
                  }
                }
              })
            } else {
              // 没有分销信息
              this.getRecruitInfo()
            }
          }
        })
      })
    },
    /**
       * 获取分销推广信息
       */
    getRecruitInfo () {
      const params = {
        url: '/p/distribution/recruit/info',
        method: 'GET',
        data: {
          shopId: 1
        },
        callBack: res => {
          uni.navigateTo({
            url: res.state ? '/pages/apply-dist/apply-dist' : '/pages/apply-dist-con/apply-dist-con'
          })
        }
      }
      http.request(params)
    },
    toAfterSalesPage: function () {
      util.tapLog(3)
      util.checkAuthInfo(() => {
        uni.navigateTo({
          url: '/pages/after-sales/after-sales'
        })
      })
    },
    toCouponCenter: function () {
      util.tapLog(3)
      util.checkAuthInfo(() => {
        uni.navigateTo({
          url: '/package-activities/pages/coupon-center/coupon-center'
        })
      })
    },
    toMyCouponPage: function () {
      util.tapLog(3)
      util.checkAuthInfo(() => {
        uni.navigateTo({
          url: '/package-activities/pages/my-coupon/my-coupon'
        })
      })
    },
    toAddressList: function () {
      util.tapLog(3)
      util.checkAuthInfo(() => {
        uni.navigateTo({
          url: '/pages/delivery-address/delivery-address'
        })
      })
    },
    toCouponList: function () {
      util.tapLog(3)
      util.checkAuthInfo(() => {
        uni.navigateTo({
          url: '/pages/coupon-list/coupon-list'
        })
      })
    },
    // 跳转绑定手机号
    toBindingPhone: function () {
      uni.navigateTo({
        url: '/pages/binding-phone/binding-phone'
      })
    },
    toOrderListPage: function (e) {
      util.tapLog(3)
      var sts = e.currentTarget.dataset.sts
      util.checkAuthInfo(() => {
        // uni.navigateTo({
        // 	url: '/pages/order-list/order-list?sts=' + sts
        // });
        this.$Router.push({
          path: '/pages/order-list/order-list',
          query: {
            sts: sts
          }
        })
      })
    },

    /**
       * 查询所有的收藏量
       */
    showCollectionCount: function () {
      var ths = this
      var params = {
        url: '/p/user/collection/count',
        method: 'GET',
        data: {},
        callBack: function (res) {
          ths.setData({
            collectionCount: res
          })
        }
      }
      http.request(params)
    },

    /**
       * 我的收藏跳转
       */
    myCollectionHandle: function () {
      util.tapLog(3)
      util.checkAuthInfo(() => {
        var url = '/pages/prod-classify/prod-classify?sts=5'
        var id = 0
        var title = this.i18n.myCollection
        if (id) {
          url += '&tagid=' + id + '&title=' + title
        }
        uni.navigateTo({
          url: url
        })
      })
    },

    /**
       * 跳转积分中心
       */
    toMemberInteral () {
      util.tapLog(3)
      util.checkAuthInfo(() => {
        uni.navigateTo({
          url: '/package-member-integral/pages/integral-index/integral-index'
        })
      })
    },

    /**
       * 跳转修改密码
       */
    setPassword: function () {
      util.tapLog(3)
      uni.navigateTo({
        url: '/pages/account-login/account-login?isForgetPassword=true' + '&isPersonalCenter=true'
      })
    },

    /**
       * 退出登录
       */
    logout: function () {
      util.tapLog(3)

      // 请求退出登陆接口
      http.request({
        url: '/logOut',
        method: 'POST',
        callBack: res => {
          util.removeTabBadge()
          uni.removeStorageSync('loginResult')
          uni.removeStorageSync('token')
          uni.removeStorageSync('tempToken')
          uni.removeStorageSync('recentSearch')
          uni.removeStorageSync('code')

          // 重置uuid、uuidSession、sessionTimeStamp、step、flowAnalysisLogDto
          uni.setStorageSync('uuid', util.getUuid())
          uni.setStorageSync('uuidSession', util.getUuid())
          uni.setStorageSync('sessionTimeStamp', new Date().getTime())
          uni.setStorageSync('step', 0)
          uni.setStorageSync('flowAnalysisLogDto', '')
          this.$Router.pushTab('/pages/index/index')
        }
      })
    },

    /**
       *  跳转登录页面
       */
    toLogin () {
      util.tapLog(3)
      util.checkAuthInfo()
    },

    /**
       * 跳转到和商家客服聊天的界面
       */
    gotoChat () {
      util.checkAuthInfo(() => {
        uni.navigateTo({
          url: '/pages/chat/chat'
        })
      })
    },
    /**
       * 跳转到企业资质
       */
    goAbout () {
      uni.navigateTo({
        url: '/pages/about/about'
      })
    },
    /**
     * 跳转到隐私协议
     */
    goPrivacyAgreement () {
      // console.log('====>>>>');
      // uni.navigateTo({
      //   url: '/pages/privacy_page/privacy_page'
      // })
      uni.navigateTo({
        url: "/pages/web-view/web-view?url=https://mall-app.cqone.cn/#/privacy?head=none"
      })
    }
  }
}
</script>
<style scoped lang='scss'>
@import "./user.css";
.container {
  padding: 0;
}
.page {
  background-color: #f2f2f2;
  position: relative;
  width: 100%;
  overflow: hidden;
  height: 100%;
  .section_1 {
    position: relative;
    width: 100%;

    .section_2 {
      background-color: rgba(255, 255, 255, 1);
      border-radius: 13px;
      width: 100%;
      padding: 26rpx 0;
      justify-content: center;
      .list_1 {
        display: flex;
        height: 101.16279069767442rpx;
        align-items: center;
        .image-text_1 {
          width: 25%;
          justify-content: center;
          align-items: center;
          //width: 97.67441860465117rpx;
          height: 99.4186046511628rpx;
          .label_1 {
            width: 55.81395348837209rpx;
            height: 55.81395348837209rpx;
            //margin-left: 20.930232558139537rpx;
          }
          .text-group_1 {
            width: 97.67441860465117rpx;
            height: 34.883720930232556rpx;
            overflow-wrap: break-word;
            color: rgba(17, 17, 17, 1);
            font-size: 24.41860465116279rpx;
            font-family: Source Han Sans-Normal;
            text-align: center;
            white-space: nowrap;
            line-height: 34.883720930232556rpx;
            margin-top: 8.720930232558139rpx;
          }
        }
      }
    }
    .section_3 {
      background-color: rgba(255, 255, 255, 1);
      border-radius: 13px;
      width: 100%;
      padding: 26rpx 0;
      .grid_1 {
        width: 100%;
        .image-text_2 {
          width: 25%;
          text-align: center;
          &:nth-child(4n) {
            margin-right: 0;
          }
          &:nth-last-child(-n + 2) {
            margin-bottom: 0;
          }
          .label_2 {
            width: 55.8139534884rpx;
            height: 55.8139534884rpx;
            display: block;
            margin: 0 auto;
          }
          .text-group_2 {
            width: 97.67441860465117rpx;
            height: 34.883720930232556rpx;
            overflow-wrap: break-word;
            color: rgba(17, 17, 17, 1);
            font-size: 24.41860465116279rpx;
            font-family: Source Han Sans-Normal;
            font-weight: NaN;
            text-align: center;
            white-space: nowrap;
            line-height: 34.883720930232556rpx;
            margin-top: 8.720930232558139rpx;
          }
        }
      }
    }

    .section_6 {
      width: 750rpx;
      background: url(https://mall-1312577323.cos.ap-chengdu.myqcloud.com/mall/images/user/MasterDDSSlicePNG77b5e68d6cb97410807b4d64f503436f.png)
        100% no-repeat;
      background-size: 100% 40%;
      background-position: 0 0;
      .image-text_4 {
        width: 383.72093023255815rpx;
        height: 104.65116279069767rpx;
        margin: 106.3953488372093rpx 0 0 34.883720930232556rpx;
        .image_1 {
          width: 104.65116279069767rpx;
          height: 104.65116279069767rpx;
          border-radius: 50%;
        }
        .text-group_4 {
          width: 258.13953488372096rpx;
          height: 87.20930232558139rpx;
          margin-top: 8.720930232558139rpx;
          .text_1 {
            width: 358.13953488372096rpx;
            height: 45.348837209302324rpx;
            overflow-wrap: break-word;
            color: rgba(17, 17, 17, 1);
            font-size: 31.3953488372093rpx;
            font-family: Source Han Sans-Medium;
            font-weight: 600;
            text-align: left;
            white-space: nowrap;
            line-height: 45.348837209302324rpx;
          }
          .text_2 {
            &:nth-child(4n) {
              margin-right: 0;
            }
            &:nth-last-child(-n + 2) {
              margin-bottom: 0;
            }
            width: 319.7674418604651rpx;
            height: 34.883720930232556rpx;
            overflow-wrap: break-word;
            color: rgba(105, 104, 104, 1);
            font-size: 24.41860465116279rpx;
            font-family: Source Han Sans-Regular;
            font-weight: NaN;
            text-align: left;
            white-space: nowrap;
            line-height: 34.883720930232556rpx;
            margin-top: 6.976744186046512rpx;
          }
        }
      }
      .block_1 {
        width: 660.2325581395348rpx;
        height: 88.95348837209302rpx;
        background: url(https://mall-1312577323.cos.ap-chengdu.myqcloud.com/mall/images/user/MasterDDSSlicePNG5f48cc3f4b87509979815198e820f448.png)
          100% no-repeat;
        background-size: 100% 100%;
        margin-top: 34rpx;
        padding: 0 20.930232558139537rpx;
        display: flex;
        align-items: center;
        .text_3 {
          width: 130rpx;
          height: 38.372093023255815rpx;
          overflow-wrap: break-word;
          color: rgba(255, 255, 255, 1);
          font-weight: 400;
          font-size: 31rpx;
          color: #ffffff;
          line-height: 38rpx;
          letter-spacing: 1rpx;
          font-family: zixiaohunliliangcuheiti-Regular;
          text-align: left;
          white-space: nowrap;
          line-height: 38.372093023255815rpx;
        }
        .text_3_ {
          width: 26rpx;
          height: 36rpx;
          text-align: center;
          overflow: hidden;
          display: inline-block;
          color: #fff;
        }
        .text_4 {
          width: 330rpx;
          height: 36.627906976744185rpx;
          overflow-wrap: break-word;
          color: rgba(255, 255, 255, 1);
          font-weight: 400;
          font-size: 24rpx;
          color: #ffffff;
          text-align: left;
          white-space: nowrap;
          line-height: 36.627906976744185rpx;
          position: relative;
          top: 6rpx;
        }
        .text-wrapper_1 {
          background-color: rgba(255, 255, 255, 1);
          border-radius: 14px;
          height: 48.83720930232558rpx;
          width: 115.11627906976744rpx;
          position: absolute;
          right: 60rpx;
          .text_5 {
            width: 73.25581395348837rpx;
            height: 36.627906976744185rpx;
            overflow-wrap: break-word;
            color: rgba(255, 109, 19, 1);
            font-size: 24.41860465116279rpx;
            font-family: Source Han Sans CN-Regular;
            font-weight: NaN;
            text-align: left;
            white-space: nowrap;
            line-height: 36.627906976744185rpx;
            margin: 5.232558139534884rpx 0 0 20.930232558139537rpx;
          }
        }
      }
      .block_2 {
        background-color: rgba(255, 255, 255, 1);
        border-radius: 13px;
        height: 230.2325581395349rpx;
        width: 729.0697674418604rpx;
        .text-wrapper_2 {
          height: 40.116279069767444rpx;
          margin: 27.906976744186046rpx 24.41860465116279rpx 0
            24.41860465116279rpx;
          .text_6 {
            width: 111.62790697674419rpx;
            height: 40.116279069767444rpx;
            overflow-wrap: break-word;
            color: rgba(17, 17, 17, 1);
            font-size: 27.906976744186046rpx;
            font-family: Source Han Sans-Medium;
            font-weight: 500;
            text-align: left;
            white-space: nowrap;
            line-height: 40.116279069767444rpx;
            font-weight: 600;
          }
          .text_7 {
            position: relative;
            left: -48rpx;
            width: 48.83720930232558rpx;
            height: 34.883720930232556rpx;
            overflow-wrap: break-word;
            color: rgba(153, 153, 153, 1);
            font-size: 24.41860465116279rpx;
            font-family: Source Han Sans-Regular;
            text-align: left;
            white-space: nowrap;
            line-height: 34.883720930232556rpx;
            margin-top: 3.488372093023256rpx;
          }
          .thumbnail_1 {
            position: relative;
            left: 10rpx;
            top: 6rpx;
            width: 27.906976744186046rpx;
            height: 27.906976744186046rpx;
          }
        }
        .group_1 {
          width: 693rpx;
          height: 111.62790697674419rpx;
          margin: 19.186046511627907rpx 0 31.3953488372093rpx 0rpx;
          display: flex;
          justify-content: space-around;
          .image-text_5 {
            height: 97.67441860465117rpx;
            margin-top: 13.953488372093023rpx;
            position: relative;
            text-align: center;
            .label_4 {
              width: 52.325581395348834rpx;
              height: 52.325581395348834rpx;
              margin: 0 auto;
            }
            .text-group_5 {
              height: 34.883720930232556rpx;
              overflow-wrap: break-word;
              color: rgba(17, 17, 17, 1);
              font-size: 24.41860465116279rpx;
              font-family: Source Han Sans-Normal;
              font-weight: NaN;
              text-align: left;
              white-space: nowrap;
              line-height: 34.883720930232556rpx;
              margin-top: 10.465116279069768rpx;
            }
          }
          .text-wrapper_3 {
            position: absolute;
            top: -12rpx;
            right: -19rpx;
            background-color: rgba(255, 73, 22, 1);
            border-radius: 50%;
            height: 29.651162790697676rpx;
            margin-left: -17.441860465116278rpx;
            width: 29.651162790697676rpx;
            .text_8 {
              //width: 10.465116279069768rpx;
              height: 20.930232558139537rpx;
              overflow-wrap: break-word;
              color: rgba(255, 255, 255, 1);
              font-size: 20.930232558139537rpx;
              font-family: Source Han Sans-Regular;
              text-align: center;
              white-space: nowrap;
              line-height: 20.930232558139537rpx;
              //margin: 3.488372093023256rpx 0 0 10.465116279069768rpx;
              margin: auto;
            }
          }
          .text-wrapper_x1 {
            right: -8rpx !important;
          }
          .text-wrapper_x2 {
            right: -8rpx !important;
          }
          .text-wrapper_x3 {
            right: -10rpx !important;
          }
          .text-wrapper_x5 {
            right: 16rpx !important;
          }
        }
      }
    }
  }
}
</style>
